package org.hxzon.cyclone.pfgen;

import org.hxzon.cyclone.Particle;
import org.hxzon.cyclone.Vector3;

//pfgen.h
//重力发生器
public class ParticleGravity implements ParticleForceGenerator {

    private Vector3 gravity;//重力加速度

    public ParticleGravity(Vector3 gravity) {
        this.gravity = gravity;
    }

    public void updateForce(Particle particle, double duration) {
        if (!particle.hasFiniteMass()) {
            return;
        }

        particle.addForce(gravity.multi(particle.getMass()));
    }

}
